package com.tjsinfo.tjsoa.worklog.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.system.vo.User;
import com.tjsinfo.tjsoa.worklog.bo.IWorkLogDefineBo;
public class AddWorkLogDefineAction extends Action{

	private IWorkLogDefineBo workLogDefineBo;
	

	public IWorkLogDefineBo getWorkLogDefineBo() {
		return workLogDefineBo;
	}


	public void setWorkLogDefineBo(IWorkLogDefineBo workLogDefineBo) {
		this.workLogDefineBo = workLogDefineBo;
	}


	/* (non-Javadoc)
	 * @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		// TODO Auto-generated method stub
		HttpSession session = request.getSession();
		User user = (User)session.getAttribute("user");
		
		if (workLogDefineBo.addDefine(user, request.getParameterValues("checkbox2"), "D")) {
			//设置成功提示
			request.setAttribute("start", 1);
			return mapping.findForward("ok");
		} else {
			return mapping.findForward("error");
		}
	
	}
	
}